#import "ChanceDecision.h"
#import "Devourer.h"
#import "InvaderManager.h"
#import "SpellSlot.h"
#import "BuffManager.h"

enum LayerZOrder
{
	lzo_bg,
	lzo_invaders,
	lzo_devourer,
	lzo_score,
	lzo_spell,
	lzo_menu,
};

@interface SceneGame : CCScene
{
}
-(id)initWithMode:(GameMode)mode;
@end

@interface LayerGame : CCLayer
{
	CCLayer* mLayerExplodeScore;
	
	Devourer* mDevourer;
	InvaderManager* mInvaders;
	SpellSlot* mSpell;
	BuffManager* mBuff;
	
	CCSprite* mLifes[3];
	int mLifeCount;
	
	CCLabelTTF* mLabelTotalScore;
	CCLabelTTF* mLabelBonus;
	CCLabelTTF* mLabelTime;
	
	ChanceDecision mChance;
	
	int mLevel;
	int mSubLevel;
	
	CCAction* mActionBlink;
	CCAction* mActionEmit;
	CCAction* mActionScore;
	CCAction* mActionSpeed;
	CCAction* mActionBless;
	CCAction* mActionAngel;
	CCAction* mActionShield;
	CCAction* mActionSmall;
	
	CCSprite* mSpriteMiss[3];
	CCAction* mActionMiss[3];

	float mEmitRate;					// 侵略者发射间隔
	float mEmitTime;					// 当前发射时间记录
	
	float mTimePassed;
	UITouch* mTouch;
	CGPoint mLastTouchPos;
	bool mStarted;
	bool mFinished;
	bool mTimeBlinked;
}

-(id)initWithMode:(GameMode)mode;

-(void)levelup:(ccTime)dt;
-(void)updateInvader:(ccTime)dt;

-(void)startGame;
-(void)endGame;
-(void)callResult;
-(void)callMenu:(CCMenuItem*)sender;

-(void)particleEF:(int)type pos:(CGPoint)pos;
-(void)scoreEF:(CGPoint)pos score:(int)score type:(InvaderType)type;
-(void)explode:(int)type;

-(void)castSpell:(Spell*)spell;
-(void)setState:(Spell*)spell;
-(void)restoreBless;
-(void)restoreAngel;
-(void)restoreBurst;
-(void)restoreFreeze;
-(void)restoreDouble;
-(void)restoreShield;
-(void)restoreSmall;

-(void)blinkBonus;
-(void)updatePos;

@end